All Questions
Tagged with design-patternsunit-testing
27 questions
3votes
2answers
306views
Replace words from a file with words from a dictionary based file
I'm working on a coding challenge that tasks me with taking a file with a dictionary, reading from it, and then replacing the matching words from the input file with what is found in the dictionary. I ...
8votes
1answer
3kviews
Testing lower- and upper bound values in Python
Code functionality The following code tests whether the values that a user specifies for a lower bound and upper bound on two properties: The lower bound is smaller than the upper bound. The values ...
5votes
1answer
43views
CandidateArchive for model-assisted multi-fidelity global search algorithm
For my research I'm working on global search methods where a candidate solution can have it's fitness (=score) evaluated in multiple fidelities (=accuracy levels). The goal of the ...
0votes
1answer
243views
Abstracting an Email Notification Service & testing the the logic of the used abstract factory
In my application I have an Interface IEmailNotification that represents an Email and the concrete implementations have nothing to do with ...
3votes
2answers
293views
Simple OOP currency converter - follow-up
This is a follow up question on this post This is what I changed on my previous code: I use Exchanger and PairCurrency class ...
3votes
3answers
129views
Testing PersonFirstName class as a Value Object
For reference: A Value Object is an immutable type that is distinguishable only by the state of its properties. That is, unlike an Entity, which has a unique identifier and remains distinct even if ...
1vote
1answer
67views
Functional tests for a web app repeating the same code
My problem/concern is that I am trying to remove duplicate code from my functional tests without breaking the Page Object Pattern that I am following. If you look at the code below, you will notice ...
3votes
1answer
172views
Simple Wizard Goblin User Story Test Driven Development
I have written this to practice Test Driven Development. I would like to know if the process is right and how it could be improved. Problem Statement : A wizard can cast spell on goblin and make his ...
2votes
0answers
316views
ASP.NET MVC with automatic testing (follow up)
This is a follow-up of this question regarding MVC application architecture fit for automatic testing. I have rewritten the DI code based on the answer provided there and also created some tests to ...
1vote
1answer
2kviews
ASP.NET MVC application architecture fit for unit testing with mocking
I am trying to learn how to professionally work with unit testing, so I have refactored a medium sized project of mine (a sort of article aggregator that also does some NLP processing) and tried to ...
4votes
1answer
478views
Unit testing a service to return items from a database
I have been a developer for many years and get core development concepts, as well as unit testing ones such as DI/Ioc, Mocking etc. I also understand the values, importance of unit testing and writing ...
7votes
6answers
4kviews
Super Market Checkout Pricing Strategies
I saw this question and thought it looked like a great opportunity to try my hand at the Strategy Pattern. I've never used it before, but I think I did pretty well. Did I? The code below can also be ...
1vote
1answer
95views
Creating various types of menus using dependency injection
I am here to discuss what are the possible improvement can be made in order to make the following code covering all the principles of programming paradigm ( SOLID , DRY ...etc ). Basically, I am ...
6votes
2answers
12kviews
Stack data structure unit testing
I have this contract: public interface Stack<T> { void push(T object); T pop(); int size(); } I am curious what you think about my test of the <...
2votes
1answer
173views
Connecting to an insurance database
I'm developing an Android application which would remotely connect to an insurance database and perform some basic CRUD operations and I'd like to learn how to keep clean app's architecture from ...